import http from 'k6/http';
import {check, sleep} from 'k6';
export let options = {
	stages:[
		{duration:'30s', target:20},  
		{duration:'1m30s', target:10},
		{duration:'20s', target:0},
	],
};
export default function(){
	let res = http.get('http://www.baidu.com');
	check(res, {'status was 200':(r)=>r.status==200});
	sleep(1);
}
options.stages 阶段性增加或减少用户数
stages:[
		{duration:'30s', target:20},  //30s内增加20个虚拟用户
		{duration:'1m30s', target:10},//1m30s内减少到10个虚拟用户
		{duration:'20s', target:0},//20s内虚拟用户数减少到0
	],